<template>
    <div class="child">
        <h2>子组件</h2>
        <h3>玩具：{{ toy }}</h3>
        <button @click="emit('get-toy', toy)">发送玩具</button>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
const emit = defineEmits(['get-toy'])
const toy = ref('变形金刚')

</script>

<style scoped>
.child {
    padding: 10px;
    box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
    background-color: skyblue;
    border-radius: 10px;
}
</style>